package com.hex.ds.hdtp.core.web.data.table.controller;

import com.hex.ds.hdtp.core.app.common.page.dto.PageDto;
import com.hex.ds.hdtp.core.app.data.table.dto.request.TableTransferRunLogRequestDto;
import com.hex.ds.hdtp.core.app.data.table.service.ITableTransferRunLogService;
import com.hex.ds.hdtp.core.web.common.page.PageVo;
import com.hex.ds.hdtp.core.web.common.page.converter.IPageVoAndPageDtoConverter;
import com.hex.ds.hdtp.core.web.data.table.converter.ITableTransferRunLogVoConverter;
import com.hex.ds.hdtp.core.web.data.table.vo.query.TableTransferRunLogQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Package com.hex.ds.hdtp.core.web.data.table.controller
 * @ClassName TableTransferRunLogController
 * @Description 表迁移执行记录-WEB接口
 * @Author Wang zhihao
 * @Date 2023/8/9 14:38
 * @Version v1.0
 **/
@Slf4j
@RestController
@Api(tags = "01-表迁移：记录")
@RequestMapping("/api/data/table/runLog")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class TableTransferRunLogController {

    private final ITableTransferRunLogService tableTransferRunLogService;

    private final ITableTransferRunLogVoConverter converter;

    private final IPageVoAndPageDtoConverter pageVoAndPageDtoConverter;

    /**
     * @param tableTransferRunLogQueryVo
     * @param pageVo
     * @Method queryListByPage
     * @Param
     * @Return org.springframework.http.ResponseEntity
     * @Description 表迁移执行记录-分页查询
     * @Author Wang zhihao
     * @Date 2023/8/9 14:36
     * @Version V1.0
     */
    @GetMapping
    @ApiOperation("表迁移任务-分页查询")
    public ResponseEntity queryListByPage(TableTransferRunLogQueryVo tableTransferRunLogQueryVo, PageVo pageVo) {
        log.debug("进入到【TableTransferRunLogController.queryListByPage】方法,参数：{}" + tableTransferRunLogQueryVo.toString());
        final PageDto pageDto = pageVoAndPageDtoConverter.toPageDto(pageVo);
        TableTransferRunLogRequestDto requestDto = converter.toRequestDtoByQuery(tableTransferRunLogQueryVo);
        return ResponseEntity.ok(tableTransferRunLogService.queryListByPage(requestDto, pageDto));
    }


}
